﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FerrScript
{
    class ParseElement
    {
        #region Fields
        internal string value;
        internal List<ParseElement> subElements;
        #endregion

        #region Constructors
        public ParseElement()
        {
            value = "";
        }
        public ParseElement(string aValue)
        {
            value = aValue;
        }
        #endregion

        #region Methods
        public bool IsAtom()
        {
            if (subElements == null || subElements.Count == 0)
                return true;
            return false;
        }
        #endregion

        #region Overrides
        public override string ToString()
        {

            string ret = "";
            if (subElements == null)
                ret += " " + value;
            else
            {
                ret += "(" + value;
                for (int i = 0; i < subElements.Count; i++)
                {
                    ret += subElements[i];
                }
                ret += ")";
            }

            return ret;
        }
        #endregion
    }
}
